package universe_test


import "testing"

option now = () => 2030-01-01T00:00:00Z

inData =
    "
#datatype,string,long,dateTime:RFC3339,string,long,string
#group,false,false,false,true,false,true
#default,_result,,,,,
,result,table,_time,_measurement,values,_field
,,0,2018-05-22T19:53:30Z,_m,1,f0
,,0,2018-05-22T19:53:40Z,_m,1,f0
,,0,2018-05-22T19:53:50Z,_m,1,f0
,,0,2018-05-22T19:53:00Z,_m,1,f0
,,0,2018-05-22T19:53:10Z,_m,1,f0
,,0,2018-05-22T19:53:20Z,_m,1,f0
,,0,2018-05-22T19:53:30Z,_m,1,f0
,,0,2018-05-22T19:53:40Z,_m,1,f0
,,0,2018-05-22T19:53:50Z,_m,1,f0
,,0,2018-05-22T19:54:00Z,_m,1,f0
,,0,2018-05-22T19:54:10Z,_m,1,f0
,,0,2018-05-22T19:54:30Z,_m,1,f0
,,0,2018-05-22T19:54:40Z,_m,1,f0
,,0,2018-05-22T19:53:50Z,_m,1,f0
,,0,2018-05-22T19:54:00Z,_m,1,f0
,,0,2018-05-22T19:53:10Z,_m,1,f0
,,0,2018-05-22T19:53:30Z,_m,1,f0
,,0,2018-05-22T19:54:40Z,_m,1,f0
,,0,2018-05-22T19:53:50Z,_m,1,f0
,,0,2018-05-22T19:54:00Z,_m,1,f0
,,0,2018-05-22T19:54:10Z,_m,1,f0
,,0,2018-05-22T19:54:20Z,_m,1,f0
"
outData =
    "
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,long,string
#group,false,false,true,true,false,true,false,true
#default,_result,,,,,,,
,result,table,_start,_stop,_time,_measurement,values,_field
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:30Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:40Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:50Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:00Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:10Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:20Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:30Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:40Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:50Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:54:00Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:54:10Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:54:30Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:54:40Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:50Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:54:00Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:10Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:30Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:54:40Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:53:50Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:54:00Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:54:10Z,_m,1,f0
,,0,2018-05-15T00:00:00Z,2030-01-01T00:00:00Z,2018-05-22T19:54:20Z,_m,1,f0
"
t_cumulative_sum_noop = (table=<-) =>
    table
        |> range(start: 2018-05-15T00:00:00Z)
        |> cumulativeSum()

test _cumulative_sum_noop = () =>
    ({input: testing.loadStorage(csv: inData), want: testing.loadMem(csv: outData), fn: t_cumulative_sum_noop})
